The files contained on this directory are updated versions of the original
simulation package provide with the publication: "Calculating Slow Motional
Magnetic Resonance Spectra A User's Guide" by David J. Schneider and Jack H
Freed, From "Biological Magnetic Resonance, Vol. 8, Eds. Lawrence J.
Berliner and Jacques Reuben, Plenum, 1989.  See the file UPDATE.DOC for
changes made since the original publication.  

The most recent modifications (Sept. 18, 1997) are described in the
UPDATE.DOC file. 

To obtain a working version of these programs, ftp the files contained here
to your computer and issue the command "make all" to compile them.  This
should work directly on the RS/6000 line of computers and modifications may
have to be made for other compters.  If you have the tar facility on your
computer you should be able to transfer the file EPRLL.tar that contains all
the files (created by: tar -cvf .EPRLL.tar *;mv .EPRLL.tar EPRLL.tar) and
extract the files with the command: tar -x EPRLL.tar.  Remember you must ftp
the tar file in binary mode.

When the executables are correctly compiled check the following inputs and
responses as a test for the correct operation of the programs:

Use program lbll to input the parameters of the spectrum to be calculated
(here we take the example lbl1.dat from the appendix of the above
publication).  The dialog from program lbll is as follows (note the default
values are from a prior calculation, where they are the same as what you
want, you need only enter a cr):

First, a straight simulation:
1. input fitting parameters:

skeeve>lbll rcc


  ######################################################################


                         program LBLL
                      Version 1.6b 2-Sep-97
                      ----------------
  Data file rcc.par already exists on the disk
  g-tensor [gxx,gyy,gzz] :  2.0088000   2.0061000   2.0027000
 New value(s) > 
  twice the nuclear spin [in2] :  2
 New value(s) > 
  A-tensor [axx,ayy,azz] (gauss) :     5.800      5.800     30.800
 New value(s) > 
  Nuclear gyromagnetic ratio [gamman] radian/(sec*gauss) :   .000000E+00
 New value(s) > 
  Linewidth tensor [wxx,wyy,wzz] (gauss) :    .00     .00     .00
 New value(s) > 
  static field [B0] (gauss) :   3200.000
 New value(s) > 
  diffusion parameter [ipdf] : 0
          ipdf=0 --> brownian diffusion
          ipdf=1 --> free or jump diffusion
          ipdf=2 --> anisotropic viscosity (if ist=0)
 New value(s) > 
  diffusion tensor [dx,dy,dz] (1/sec) =  .1000E+08    .1000E+08    .1000E+08
 New value(s) > 
  discrete jumps motion [ist,djf] :  0    .000000E+00
    (if ipdf=2 then ist=0 and djf is the parallel
    diffusion coefficient in the director frame)
 New value(s) > 
  Heisenberg spin exchange frequency [oss] =   .0000E+00
 New value(s) > 
  number of terms in the potential [ipt] = 0
 New value(s) > 
  diffusion tilt [ald,bed,gad] (degrees):     .0,    .0,    .0
 New value(s) > 
  magnetic tilt [alm,bem,gam] (degrees):     .0,    .0,    .0
 New value(s) > 
  truncation values  [lemx,lomx,kmx,mmx,ipnmx] :   6,  3,  2,  2,  2
 New value(s) > 

  *** Dimension of basis =     42 ***

  number of Lanczos/CG steps [nstep] :    33
 New value(s) > 
  calculation type (0=L,1=CG,2=FS) [itype] : 2
 New value(s) > 0


  #########################   file : rcc.par   #########################


  g-tensor [gxx,gyy,gzz] :  2.0088000   2.0061000   2.0027000
  twice the nuclear spin [in2] :  2
  A-tensor [axx,ayy,azz] (gauss) :     5.800      5.800     30.800
  Inhomog. linewidth tensor [wxx,wyy,wzz] (gauss) :      .000       .000       .000
  static field [B0] (gauss) :    3200.000
  diffusion parameter [ipdf] = 0
  diffusion tensor [dx,dy,dz] (1/sec) =  .1000E+08    .1000E+08    .1000E+08
  Heisenberg spin exchange frequency [oss] =   .0000E+00
  number of terms in the potential [ipt] = 0
  angle between B0 and local director [psi] (degrees) :     .00
  diffusion tilt flag [itd] = 0
  diffusion tilt flag [itd] = 0
  truncation values  [lemx,lomx,kmx,mmx,ipnmx] :   6    3    2    2    2
  number of Lanczos/CG steps [nstep] :    33
  calculation type (0=L,1=CG,2=FS) [itype] : 0


  ######################################################################


  Write basis set indices to rcc.fmt? [N]: 



  ######################################################################


2. Now use the program eprll to calculate the tridiagonal matrix.

skeeve>eprll rcc
  ######################################################################
                         program EPRLL
                      Version 1.6b 2-Sep-97
                      ----------------
  ######################################################################
               ======================================
               Calculation no.  1 using file rcc.par
               ======================================

               *** Calculating matrix elements ***
  Dimension of the matrix :     42
  Number of off-diagonal real elements:        0
  Number of off-diagonal imaginary elements:      186
  Total number of off-diagonal elements:      186
  CPU time (seconds) :        .03

               *** Calculating starting vector ***
  Number of non-zero elements in starting vector :     3
  CPU time (seconds) :        .05

               *** Calculating tridiagonal matrix ***
  CPU time (seconds) :        .02

                    *** Writing rcc.par ***

                    *** Writing rcc.tdl ***
  ######################################################################
               *** Total CPU time (seconds) :        .18 ***

3. Lastly use tdll to calculate the desired spectrum:

skeeve>tdll rcc

######################################################################

                         program TDLL
                      Version 1.6b 2-Sep-97
                      ----------------


                         file : rcc.tdl

     1 - list elements of tridiagonal matrix on screen
     2 - write tridiagonal matrix into formatted file
     3 - diagonalize tridiagonal matrix
     4 - generate cw spectrum from continued fraction
     5 - exit program
     <ENTER> - next file

          please select option : 
4


  Please enter initial and final fields relative to B0 =  3200.00
  [ bi =  -500.00, bf =   500.00 ]
 New value(s) > -50 50

  Please enter inhomogeneous linewidth
  [ gib0 = .00000E+00 ]
 New value(s) > .5

  Please enter number of Lanczos steps
   for calculation
  [ nstep =  33 ]
 New value(s) > 

  Please specify 0th or 1st derivative spectrum
  [ ideriv = 1 ]
 New value(s) > 

  Please specify number of points in spectrum [max   512]
  [ npts =  512 ]
 New value(s) > 


                         file : rcc.tdl

     1 - list elements of tridiagonal matrix on screen
     2 - write tridiagonal matrix into formatted file
     3 - diagonalize tridiagonal matrix
     4 - generate cw spectrum from continued fraction
     5 - exit program
     <ENTER> - next file

          please select option : 
5

The derivative spectrum is calculated and stored in file rcc.spc where the
three columns contain field, absorption and dispersion values.  The data in
the file rcc.spc is to be compared with the published figure 9 of Schneider
and Freed.

***********

To demonstrate the pruning of the basis set, we will redo the calculation as
follows.  Use lbll again on the file rcc with entries choosing field sweep
calculation with the maximum number of field positions, and the pruning
tolerance of zero.  This will not actually prune the basis set since the
tolerance is zero but it will calculate the information needed for later
pruning.  An actual tolerance could be selected at this stage but then a
tighter tolerance would require redoing this program which might be time
consuming, whereas pruning with zero tolerance allows an easy calculation 
later to set a specific tolerance.  (See below).

skeeve>lbll rcc
........ (stuff deleted)

  calculation type (0=L,1=CG,2=FS) [itype] : 0
 New value(s) > 2
  error tolerance for residual [cgtol] :   .1000E-03
 New value(s) > .1e-3
  origin shift [shiftr,shifti] :    .0000E+00    .0000E+00
 New value(s) > 
  initial and final fields relative to B0=  3200.000
  [fieldi,fieldf] (gauss) :       .000        .000
 New value(s) > -50 50
  number of field positions [nfield< 31] :   0
 New value(s) > 30
  pruning tolerance [btol] :  .000E+00
 New value(s) > 


  #########################   file : rcc.par   #########################


  g-tensor [gxx,gyy,gzz] :  2.0088000   2.0061000   2.0027000
  twice the nuclear spin [in2] :  2
  A-tensor [axx,ayy,azz] (gauss) :     5.800      5.800     30.800
  Inhomog. linewidth tensor [wxx,wyy,wzz] (gauss) :  .000 .000  .000
  static field [B0] (gauss) :    3200.000
  diffusion parameter [ipdf] = 0
  diffusion tensor [dx,dy,dz] (1/sec) =  .1000E+08    .1000E+08    .1000E+08
  Heisenberg spin exchange frequency [oss] =   .0000E+00
  number of terms in the potential [ipt] = 0
  angle between B0 and local director [psi] (degrees) :     .00
  diffusion tilt flag [itd] = 0
  diffusion tilt flag [itd] = 0
  truncation values  [lemx,lomx,kmx,mmx,ipnmx] :   6    3    2    2    2
  number of Lanczos/CG steps [nstep] :    40
  calculation type (0=L,1=CG,2=FS) [itype] : 2
  error tolerance for residual [cgtol] :   .1000E-02
  origin shift [shiftr,shifti] :    .3000E-13    .0000E+00
  field sweep [fieldi,fieldf] (gauss) :    -50.000      50.000
  number of field positions [nfield] :  30
  pruning tolerance [btol] :   .0000


  ######################################################################


  Write basis set indices to rcc.fmt? [N]: 

n



  ######################################################################


skeeve>

now, copy the previous simulation to save for comparison with the pruned
simulation:

skeeve>mv rcc.spc rccsv.spc


Now generate the field sweep information:

skeeve>eprbl rcc
  ######################################################################
                         program EPRBL
                      Version 1.6b 2-Sep-97
                      ----------------
  ######################################################################
                         file : rcc.par

               *** Calculating starting vector ***
  Number of non-zero elements in starting vector :     3
  CPU time (seconds) :        .03

               *** Calculating matrix elements ***
  +--------+-----------+----------------+----------------+
  | Step   | Number of |   Modulus of   |  L2 norm of    |
  | number | CG steps  |   rectanorm    |  true residual |
  |--------+-----------+----------------+----------------|
  |      1 |        8  |   .6798014E-04 |   .1505974E-03 |        .00
  |      2 |        9  |   .3746515E-04 |   .7892333E-04 |        .00
  |      3 |        9  |   .7834264E-04 |   .1650350E-03 |        .02
  |      4 |       10  |   .6480027E-04 |   .1694439E-03 |        .00
  |      5 |       11  |   .6289232E-04 |   .1854029E-03 |        .00
  |      6 |       12  |   .8250544E-04 |   .1769422E-03 |        .02
  |      7 |       14  |   .3491780E-04 |   .9062788E-04 |        .00
  |      8 |       17  |   .3120669E-04 |   .1243546E-03 |        .02
  |      9 |       20  |   .3911817E-04 |   .8029102E-04 |        .00
  |     10 |       21  |   .9780757E-04 |   .3823503E-03 |        .00
  |     11 |       26  |   .5208879E-04 |   .1344614E-03 |        .02
  |     12 |       30  |   .1436835E-04 |   .5794715E-04 |        .00
  |     13 |       32  |   .6881573E-04 |   .1351033E-03 |        .02
  |     14 |       33  |   .7559590E-04 |   .1732371E-03 |        .02
  |     15 |       37  |   .3673547E-04 |   .6996697E-04 |        .00
  |     16 |       36  |   .8451644E-04 |   .1467376E-03 |        .02
  |     17 |       33  |   .5221991E-04 |   .1196814E-03 |        .02
  |     18 |       30  |   .3204166E-04 |   .1292230E-03 |        .02
  |     19 |       26  |   .6786289E-04 |   .1751805E-03 |        .00
  |     20 |       23  |   .4132867E-04 |   .2084803E-03 |        .02
  |     21 |       20  |   .9819960E-04 |   .2015571E-03 |        .00
  |     22 |       19  |   .4216329E-04 |   .9729573E-04 |        .00
  |     23 |       17  |   .3775609E-04 |   .1504531E-03 |        .00
  |     24 |       15  |   .9823647E-04 |   .1817001E-03 |        .00
  |     25 |       14  |   .4800760E-04 |   .1246020E-03 |        .00
  |     26 |       12  |   .9512984E-04 |   .2040167E-03 |        .02
  |     27 |       11  |   .3465207E-04 |   .1021523E-03 |        .00
  |     28 |       10  |   .7173486E-04 |   .1875769E-03 |        .00
  |     29 |        9  |   .7808618E-04 |   .1644948E-03 |        .00
  |     30 |        9  |   .3737946E-04 |   .7874281E-04 |        .00
  +--------+-----------+----------------+----------------+

  Total number of maxtrix-vector multiplies :   603
  Maximum true error :   .3823503E-03
  Total CPU time for swept-field calc (seconds) :        .18
             *** writing file rcc.bss ***
             *** writing file rcc.spc ***
             *** writing file rcc.mts ***

  unpruned dimension =   42     pruned dimension =    42

  --------------------------------------------------------------------------
   error       Le        Lo        K         M         pI      MTS    pruned
            min  max  min  max  min  max  min  max  min  max   dim      dim
  ---------+---------+---------+---------+---------+---------+-------+------
   .000E+00|   0   6 |   3   3 |   0   2 |   0   2 |   0   2 |    42 |    42
  ---------+---------+---------+---------+---------+---------+-------+------

             *** writing file rcc.par ***
             *** writing file rcc.ind ***
  Total CPU time for EPRBL calculation (seconds) :        .25
  ######################################################################
skeeve>

In the above, the pruned dimension is equal to the MTS dimension since the
pruning tolerance was chosen as 0.  We can now reset this tolerance with the
program prunel as follows:

skeeve>prunel rcc
  ######################################################################
                         program PRUNEL
                      Version 1.6b 2-Sep-97 
                      ----------------
               ======================================
               Pruning procedure  1 using file rcc.bss
               ======================================
  Pruning tolerance for file 'rcc' [btol]  .000E+00 : 
 New value(s) > .05
                    MTS basis dimension:   42
                    pruned dimension:      23
                    pruning tolerance :     .0500
                    Trunc. indices for pruned set:
                    lemx=  6 lomx=  3 kmn=  0 kmx=  2
                     mmn=  0 mmx=  2 ipnmx= 2

                    *** writing file rcc.ind ***
  ######################################################################
skeeve>

Redo the program lbll on file rcc, this time noting that the pruned basis set
is automatically selected.  This time do conjugate gradient calculation and
note that an origin shift of 1.0 is required.  The entries are as follows:

  truncation values  [lemx,lomx,kmx,mmx,ipnmx] :   6,  3,  2,  2,  2
 New value(s) > 

  *** Dimension of basis =     42 ***


 File 'rcc.ind' exists: pruned dimension =    23

  number of Lanczos/CG steps [nstep] :    33
 New value(s) > 33
  calculation type (0=L,1=CG,2=FS) [itype] : 2
 New value(s) > 1
  error tolerance for residual [cgtol] :   .1000E-02
 New value(s) > .1e-3
  origin shift [shiftr,shifti] :    .3000E-13    .0000E+00
 New value(s) > 1 0


  #########################   file : rcc.par   #########################


  g-tensor [gxx,gyy,gzz] :  2.0088000   2.0061000   2.0027000
  twice the nuclear spin [in2] :  2
  A-tensor [axx,ayy,azz] (gauss) :     5.800      5.800     30.800
  Inhomog. linewidth tensor [wxx,wyy,wzz] (gauss) :  .000 .000  .000
  static field [B0] (gauss) :    3200.000
  diffusion parameter [ipdf] = 0
  diffusion tensor [dx,dy,dz] (1/sec) =  .1000E+08    .1000E+08    .1000E+08
  Heisenberg spin exchange frequency [oss] =   .0000E+00
  number of terms in the potential [ipt] = 0
  angle between B0 and local director [psi] (degrees) :     .00
  diffusion tilt flag [itd] = 0
  diffusion tilt flag [itd] = 0
  truncation values  [lemx,lomx,kmx,mmx,ipnmx] :   6    3    2    2    2
  number of Lanczos/CG steps [nstep] :    33
  calculation type (0=L,1=CG,2=FS) [itype] : 1
  error tolerance for residual [cgtol] :   .1000E-03
  origin shift [shiftr,shifti] :    1.0000E+00    .0000E+00


  ######################################################################


  Write basis set indices to rcc.fmt? [N]: 

n


  ######################################################################


skeeve>

And recalculate, using the pruned basis set and the conjugate 
gradient program.

skeeve>eprcgl rcc
  ######################################################################
                         program EPRCGL
                      Version 1.6b 2-Sep-97
                      ----------------
  ######################################################################
               ======================================
               Calculation no.  1 using file rcc.par
               ======================================

               *** Calculating matrix elements ***
  Dimension of the matrix :     23
  Number of off-diagonal real elements:        0
  Number of off-diagonal imaginary elements:       67
  Total number of off-diagonal elements:       67
  CPU time (seconds) :        .05

               *** Calculating starting vector ***
  Number of non-zero elements in starting vector :     3
  CPU time (seconds) :        .05

               *** Calculating tridiagonal matrix ***
  Number of CG steps executed :    24  Error in solution vector :   .4308848E-06  CPU time (seconds) :        .02

                    *** Writing rcc.par ***

                    *** Writing rcc.tdl ***
  ######################################################################
  Total CPU time (seconds) :        .18

Note the reduced CPU time!

Generate the spectrum as before:

skeeve>tdll rcc

######################################################################

                         program TDLL
                      Version 1.6 12-Aug-94
                      ----------------


                         file : rcc.tdl

     1 - list elements of tridiagonal matrix on screen
     2 - write tridiagonal matrix into formatted file
     3 - diagonalize tridiagonal matrix
     4 - generate cw spectrum from continued fraction
     5 - exit program
     <ENTER> - next file

          please select option : 
4


  Please enter initial and final fields relative to B0 =  3200.00
  [ bi =  -50.00, bf =   50.00 ]
 New value(s) > 

  Please enter inhomogeneous linewidth
  [ gib0 = .00000E+00 ]
 New value(s) > .5

  Please enter number of Lanczos steps
   for calculation
  [ nstep =  23 ]
 New value(s) > 

  Please specify 0th or 1st derivative spectrum
  [ ideriv = 1 ]
 New value(s) > 

  Please specify number of points in spectrum [max   512]
  [ npts =  512 ]
 New value(s) > 


                         file : rcc.tdl

     1 - list elements of tridiagonal matrix on screen
     2 - write tridiagonal matrix into formatted file
     3 - diagonalize tridiagonal matrix
     4 - generate cw spectrum from continued fraction
     5 - exit program
     <ENTER> - next file

          please select option : 
5

######################################################################

skeeve>

You may now use a standard plot package to compare the two files, rcc.spc and
rccsv.spc, to check on the quality of the pruning.  In this case the files
should overlap almost exactly.  Try this again with a larger pruning
tolerance (0.2) and you will see significant spectral differences.  The
programs to run to do this are:

1. prunel - generate new pruned basis set
2. lbll - specify new number of lanczos or CG steps (for small dimensions,
we generally make the steps equal to the pruned dimension, for large basis
sets that number may be made smaller than the dimension but you must test
for convergence until you are adept at selecting minimum number of steps to
insure convergence)
3. eprll
4. tdll - generate the spectrum.  

